<!--编辑友情链接分类-->
<div class="dialog_content">
	<form id="info_form" name="info_form" action="{:url('LinkCate/editDo')}" method="post">
	<table width="100%" cellpadding="2" cellspacing="1" class="table_form">
		<tr>
			<th width="80">分类名称 :</th>
			<td><input type="text" name="name" id="name" class="input-text" value="{$info.name}"></td>
		</tr>
		<tr>
			<th>状态 :</th>
			<td>
				<label><input type="radio" name="status" class="radio_style" value="1" {if condition="$info.status eq 1"} checked="checked"{/if}> &nbsp;启用&nbsp;&nbsp;&nbsp;</label>
				<label><input type="radio" name="status" class="radio_style" value="0" {if condition="$info.status eq 0"} checked="checked"{/if}> &nbsp;禁用</label>
			</td>
		</tr>
	</table>
	<input type="hidden" name="id" value="{$info.id}" />
	</form>
</div>

<script>
var check_name_url = "{:url('LinkCate/ajaxCheckName', ['id'=>$info['id']])}";
$(function(){
	$.formValidator.initConfig({formid:"info_form",autotip:true});
	$("#name").formValidator({onshow:'请填写分类名称',onfocus:'请填写分类名称'}).inputValidator({min:1,onerror:'请填写分类名称'}).ajaxValidator({
		type : "get",
		url : check_name_url,
		datatype : "json",
		async:'false',
		success : function(result){
			if(result.status == 0){
				return false;
			}else{
				return true;
			}
		},
		onerror : '分类名称已存在',
		onwait : '验证中，请稍候...'
	}).defaultPassed();
	
	$('#info_form').ajaxForm({success:complate,dataType:'json'});
	function complate(result){
		if(result.status == 1){
			$.dialog.get(result.dialog).close();
			$.yingloujie.tip({content:result.msg});
			setTimeout(function(){window.location.reload();},1000);
		} else {
			$.yingloujie.tip({content:result.msg, icon:'alert'});
		}
	}
});
</script>